package game.aop;

import game.entity.Equip;
import org.springframework.aop.MethodBeforeAdvice;

import java.lang.reflect.Method;

/**
 * Created by datou on 2017/3/22.
 */
public class Update implements MethodBeforeAdvice {
    public void before(Method method, Object[] objects, Object o) throws Throwable {
        Equip equip=(Equip)objects[0];
        if("戒指".equals(equip.getType())){
            System.out.println("将"+equip.getName()+"升级为"+"【紫色梦幻】"+equip.getName());
            equip.setName("【紫色梦幻】"+equip.getName());
            equip.setAttackPlus(equip.getAttackPlus()+6);
            equip.setDefencePlus(equip.getDefencePlus()+6);
            System.out.println("升级成功，新属性为 ：");
            equip.infoEquip();
        }else{
            System.out.println("升级失败《该活动只能升级戒指》");
        }
    }
}
